﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class D04_Mathf5 : MonoBehaviour
{
    public Transform cubeA, sphere;

    //让sphere平滑跟随cubeA
    private void Update()
    {
        sphere.position = Vector3.Lerp(sphere.position, cubeA.position, Time.deltaTime);

        //附加效果
        float f = Mathf.Repeat(Time.time, 1);
        sphere.GetComponent<MeshRenderer>().sharedMaterial.color = Color.Lerp(Color.white, Color.red, f);
    }
}